import 'package:ati_package/core/extension/ati_widgets_extension.dart';
import 'package:ati_package/core/routes/app_routes.dart';
import 'package:ati_package/core/utils/ati_assets.dart';
import 'package:ati_package/core/utils/ati_color.dart';
import 'package:ati_package/pages/common/ati_scaffold.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';

import '../widgets/sign_hot_exchange.dart';
import '../widgets/sign_list_widget.dart';

class DailySignView extends StatefulWidget {
  const DailySignView({super.key});

  @override
  State<DailySignView> createState() => _DailySignViewState();
}

class _DailySignViewState extends State<DailySignView> {
  @override
  Widget build(BuildContext context) {
    return AtiScaffold(
      barBgColor: Colors.transparent,
      extendBodyBehindAppBar: true,
      title: '积分签到',
      actionWidget:
          Image.asset(
            width: 17.5.r,
            height: 17.5.r,
            AtiAssets.signBarIcon,
            package: 'ati_package',
          ).addTapGesture(
            onTap: () {
              Get.toNamed(AtiAppRoutes.pointsDet);
            },
          ),
      body: Stack(
        children: [
          // 背景层
          buildBgImage(),
          buildContent(),
        ],
      ),
    );
  }

  buildBgImage() {
    return Container(
      height: Get.width * 1.40,
      width: double.infinity,
      decoration: BoxDecoration(
        // gradient: LinearGradient(
        //   colors: [Color(0xFFB3E5FC), Color(0xFFC8E6C9)],
        //   begin: Alignment.topCenter,
        //   end: Alignment.bottomCenter,
        // ),
        image: DecorationImage(
          image: AssetImage(
            'assets/images/find/sign_bg.png',
            package: 'ati_package',
          ),
          fit: BoxFit.cover,
        ),
      ),
    );
  }

  //我的积分
  buildMypoints() {
    return Container(
      padding: EdgeInsets.only(top: 20.w, left: 16.r, bottom: 64.r),
      decoration: BoxDecoration(
        color: Color.fromRGBO(255, 255, 255, 0.2),
        borderRadius: BorderRadius.circular(0.r),
      ),
      child: Row(
        crossAxisAlignment: CrossAxisAlignment.center,
        children: [
          Column(
            crossAxisAlignment: CrossAxisAlignment.start,
            children: [
              Text(
                '我的积分',
                style: TextStyle(
                  fontSize: 12.sp,
                  color: AtiColor.textColor1,
                  fontWeight: FontWeight.w500,
                ),
              ),
              SizedBox(height: 5.h),
              Text(
                '29166',
                style: TextStyle(
                  fontSize: 25.sp,
                  color: AtiColor.successColor,
                  fontWeight: FontWeight.w600,
                ),
              ),
            ],
          ),
        ],
      ),
    );
  }

  buildContent() {
    return SafeArea(
      bottom: false,
      child: SingleChildScrollView(
        child: Column(
          children: [
            buildMypoints(),
            SignListWidget(),
            SignHotExchangeWidget(),
          ],
        ),
      ),
    );
  }
}
